home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: GraphicsLibrary.c Contains: graphics libraries - general library routines Written by: Cary Clark, Georgiann Delaney, Michael Fairman, Dave Good, Robert Johnson, Keith McGreggor, Mike Reed, Oliver Steele, David Van Brink, Chris Yerga Copyright: © 1995 by Apple Computer, Inc., all rights reserved. Change History (most recent first): <1> 1/9/95 JD First checked in. */ #include <Memory.h> #include "GraphicsLibraries.h" /*************/ /* General routines */ /*************/ void DisposeShapeAt(gxShape *oldShape) { NilParamReturn(oldShape); if (*oldShape) { GXDisposeShape(*oldShape); *oldShape = nil; } } void DisposeStyleAt(gxStyle *oldStyle) { NilParamReturn(oldStyle); if (*oldStyle) { GXDisposeStyle(*oldStyle); *oldStyle = nil; } } void DisposeInkAt(gxInk *oldInk) { NilParamReturn(oldInk); if (*oldInk) { GXDisposeInk(*oldInk); *oldInk = nil; } } void DisposeTransformAt(gxTransform *oldTransform) { NilParamReturn(oldTransform); if (*oldTransform) { GXDisposeTransform(*oldTransform); *oldTransform = nil; } } /****************/ /* operations on shapes */ /****************/ static void GetSpaceMapping(gxViewPort port, gxViewDevice device, gxMapping *map) { if (port) GXGetViewPortGlobalMapping(port, map); else ResetMapping(map); if( device ) { gxMapping temp; MapMapping(map, GXGetViewDeviceMapping(device, &temp)); } } void MapShapeToSpace(gxShape source, gxViewPort port, gxViewDevice device) { gxMapping map; GetSpaceMapping(port, device, &map); GXMapShape(source, &map); } void MapShapeFromSpace(gxShape source, gxViewPort port, gxViewDevice device) { gxMapping map; GetSpaceMapping(port, device, &map); InvertMapping(&map, &map); GXMapShape(source, &map); } void MapPointToSpace(gxPoint *pt, gxViewPort port, gxViewDevice device) { gxMapping map; GetSpaceMapping(port, device, &map); MapPoints(&map, 1, pt); } void MapPointFromSpace(gxPoint *pt, gxViewPort port, gxViewDevice device) { gxMapping map; GetSpaceMapping(port, device, &map); InvertMapping(&map, &map); MapPoints(&map, 1, pt); }